package mainpackage;

import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.midlet.MIDlet;

/**
 * <p>Title: 游戏入口类</p>
 * <p>Description: ��׼midlet</p>
 * <p>Copyright: Copyright (c) 2010</p>
 * <p>Company: </p>
 * @author hlw
 * @version 1.0
 */
public class MainGame extends MIDlet {

    public static MainGame instance;
    public static MainCanvas mainFrame;
    LogoCanvas aLogoCanvas = null;
    public static Tools tools;

    public MainGame() {
        instance = this;
        this.mainFrame = new MainCanvas();
//        aLogoCanvas = new LogoCanvas();
//        Constant.CHANNEL_NUM = MainGame.instance.getAppProperty("MS_QUDAO_ID");
//        System.out.println("useid:"+Constant.CHANNEL_NUM );
        //屏蔽看图
        tools = new Tools();
        tools.dummy();
        if(InputInterFace.commonInput == null) {
        	System.out.println("InputInterFace.commonInput=null.....");
        }
        //
    }

    public void startApp() {
//        Display.getDisplay(this).setCurrent(aLogoCanvas);
//        this.aLogoCanvas.start();
        Display.getDisplay(this).setCurrent(mainFrame);
        this.mainFrame.start();
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }

    public static void quitApp() {
        instance.destroyApp(true);
        instance.notifyDestroyed();
        instance = null;
    }

    //界面的跳转
    public static void changeCanvas(Displayable nextDisplayable) {
        Display.getDisplay(instance).setCurrent(nextDisplayable);
        if ((Displayable) nextDisplayable == mainFrame) {
            mainFrame.bInCanvas = true;
            mainFrame.setFullScreenMode(true);
        } else {
            mainFrame.bInCanvas = false;
        }
    }
//end
}
